<template>
  <div>
    <div class="his-hot">
      <div class="hd">
        <div>历史记录</div>
        <van-icon name="delete-o" />
      </div>
      <div class="bd">
        <van-tag
        @click="tagClick(item)"
          v-for="(item, index) in historyListData"
          :key="index"
          plain
          type="default"
          >{{ item }}</van-tag>
      </div>
    </div>

    <div class="his-hot">
      <div class="hd">
        <div>历史记录</div>
      </div>
      <div class="bd">
        <!-- :class="item.is_hot?'red':'' 从后端获取是否需要加红数据，用三元运算符判断 -->
        <van-tag
        @click="tagClick(item.keyword)"
          plain
          v-for="(item, index) in hotKeywordListData"
          :key="index"
          type="default"
          :class="item.is_hot ? 'red' : ''"
          >{{ item.keyword }}</van-tag>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ["historyListData", "hotKeywordListData"],
  methods:{
    tagClick(val){
      console.log(val);
      this.$emit("tagClick",val)
    }
  }
};
</script>

<style lang="scss" scoped>
.his-hot {
  background-color: #fff;
  padding: 0.1rem;
  margin-bottom: 0.2rem;
  .hd {
    display: flex;
    justify-content: space-between;
    font-size: 0.24rem;
    margin-bottom: 0.08rem;
    h4 {
      font-size: 0.24rem;
    }
  }
  .van-tag {
    margin-left: 0.05rem;
    padding: 0.03rem;
  }
  .bd {
    display: flex;
    justify-content: flex-start;
  }
  .red {
    color: darkred;
  }
}
</style>
